<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> 
<title>Insert title here</title>
<%@ include file="../mobileHeader_inc.jsp" %>
<script type="text/javascript">
function btnSave_click() {
/* 	var file = $('#uploadFile')[0];
	var imagSize =  document.getElementById("uploadFile").files[0];
	var status =  document.getElementById("status").value;
	if(imagSize != null && imagSize != "" && !isNull( imagSize )){
		imagSize = imagSize.size;
	} */

	var fun_ret;
	var vals = $('#formModule').serialize();
	var url = '/manage/sysLostAndFound/addSave';
	var formData = new FormData($('#formModule')[0]);
	$.ajax({
		async : false,
		type : "POST",
		url : url,
		data : formData,
		cache : false,
		contentType : false,
		processData : false,
		dataType : 'json',
		xhr : function() { // custom xhr
			myXhr = $.ajaxSettings.xhr();
			if (myXhr.upload) { // if upload property exists
				myXhr.upload.addEventListener('progress',
						progressHandlingFunction, false); // progressbar
			}
			return myXhr;

		},
		//Ajax events
		success : function(data) {
               if(data.success == 0 )
               {
            	   fun_ret = true;
            	   window.location.href="${ctx}/manage/index?dep=1";
               }
               else
               {
            	   alert("添加失败");
               }
           },
		error : errorHandler = function(data) {
			alert("添加失败");
			return false;
		}
	});
	return fun_ret;
}

function progressHandlingFunction(e) {
if (e.lengthComputable) {
	$('progress').attr({
		value : e.loaded,
		max : e.total
	});
}
}
</script>
</head>
<body style="background-color: #FFFAF0">
<!-- 头部 --> 
<div>
	<nav class="navbar navbar-default">
  <div class="container-fluid">
  	<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
    </button>
   	<div class="navbar-header">
      	<a class="navbar-brand" href="#">发布</a>
    </div>
    
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li><a href="#">设置 <span class="sr-only">(current)</span></a></li>
        <li><a href="#">清除 <span class="sr-only">(current)</span></a></li>
      </ul>      
  	</div>
    
  </div>
  
  
  
  
</nav>
</div>

<!-- 中间 --> 

<form class="am-form" id="formModule" method="post">
<fieldset>
<div class="am-form-group">
      <label for="doc-select-1">选择丢失或捡到</label>
      <select id="doc-select-1" name="mark">
        <option value="9">我捡到</option>
        <option value="0">我丢失</option>
      </select>
                			
      <span class="am-form-caret"></span>
    </div>
    <div class="am-form-group">
      <label for="doc-ipt-email-1">标题:</label>
      <input type="text" class="" id="arcitleName" name="arcitleName">
    </div>
    <div class="am-form-group">
      <label for="doc-ta-2">详情:</label>
      <textarea class="" rows="5" id="iteminform" name="iteminform"></textarea>
    </div>
				
	<div class="am-form-group">
    <label for="doc-ipt-email-4">学校:</label>
    <select id="doc-select-1" name="sysDepartment.depId" >
 		<c:forEach var="sharedUser" items="${dep}">
			<option value="${sharedUser.depId }">${sharedUser.depName}</option>
		</c:forEach>
 	</select>
    </div>
	
    <div class="am-form-group">
      <label for="doc-ipt-email-4">联系人:</label>
      <input type="text" class="" id="contactPerson" name="contactPerson">
    </div>
    <div class="am-form-group">
      <label for="doc-ipt-email-5">联系方式:</label>
      <input type="tel" class="" id="contactPhone" name="contactPhone">
    </div>
    <div class="am-form-group">
      <label for="doc-ipt-file-1">上传文件</label>
      <input type="file" id="uploadFile" name="uploadFile">
      <p class="am-form-help">请选择要上传的文件...</p>
    </div>
    <div align="center">
		<button type="submit" class="am-btn am-btn-default am-round" data-ajax="false" onclick="btnSave_click();" style="width:50%;">发布</button>
    </div>
    </fieldset>
</form>


<!-- 底部 --> 
<div data-am-widget="navbar" class="am-navbar  am-navbar-default gm-foot" id="">
		<ul class="am-navbar-nav am-cf am-avg-sm-4">
		<li ><a href="/manage/index?dep=1" target="_self" class="curr"> <span class="am-icon-home"></span> <span class="am-navbar-label ">市场</span> </a></li>
		
		<li > <a href="/mobile/personal" target="_self" class="curr"> <span class="am-icon-user am-navbar-label001"></span> <span class="am-navbar-label">发布</span> </a> </li>
		</ul> 
</div>
</body>
</html>